/*
PROG: secpas
LANG: C++
ID: phamnamlo2
*/

#include <iostream>
#include <cstdio>
#include <string>
#include <math.h>

using namespace std;

int n, m = 0;

void inp()
{
  cin >> n;
}
 
bool square(int k) 
{
  if (k < 0) return false;
  int temp = ceil(sqrt(k));
  if (abs(k - temp*temp) < 1E-9) return true;
  return false;
}
 
void process()
{
  int sum = 0;
  for (int i = 0; i <= 100; i++)
  {
    sum += i*i;
    for (int j = 0; j <= 100; j++) 
    {
      sum += j*j;
      for (int k = 0; k <= 100; k++)
      {
        sum += k*k;
        if (square(n-sum)) m++;
        sum -= k*k;
      }
      sum -= j*j;
    }
    sum -= i*i;
  }
}
 
void out()
{
  cout << m << endl;
}
 
main()
{
  freopen("secpas.in", "r", stdin);
  freopen("secpas.out", "w", stdout); 
  
  inp();
  process();
  out();        
  return 0;
}
